﻿using StrokeCenterSystem.Core;
using StrokeCenterSystem.TriageInfoSystem;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace StrokeCenterSystem.Code.Bll
{
    /// <summary>
    /// 医嘱相关接口
    /// </summary>
    public class DoctorAdviceManager
    {
        /// <summary>
        /// 导入医嘱信息
        /// </summary>
        /// <param name="triageId">分诊号</param>
        /// <param name="dt">查询开始时间</param>
        /// <returns></returns>
        public static OperateResult GetOrderData(string triageId, DateTime dt)
        {
            OperateResult resultInfo = new OperateResult();
            try
            {
                WebService1SoapClient service = new WebService1SoapClient();

                ResultHelperOfBoolean result = service.GetOrderData(triageId, dt);
                if (result.S)
                {
                    resultInfo.Body = result.M;
                }
                else
                {
                    resultInfo.Result = 0;
                    resultInfo.Body = result.M;
                }
            }
            catch (Exception ex)
            {
                resultInfo.Result = -1;
                resultInfo.Body = ex.Message;
            }
            return resultInfo;
        }

        /// <summary>
        /// 获取医嘱数据
        /// </summary>
        /// <param name="triageId">分诊号</param>
        /// <param name="printStatus">打印状态</param>
        /// <param name="typecode">费别状态</param>
        /// <param name="useTime">查询日期</param>
        /// <param name="effectFlg"></param>
        /// <returns></returns>
        public static OperateResult getOrderForm(string triageId, string printStatus, string typecode, string useTime, string effectFlg)
        {
            OperateResult resultInfo = new OperateResult();
            try
            {
                WebService1SoapClient service = new WebService1SoapClient();
                ResultHelperOfDataTable result = service.getOrderForm(triageId, printStatus, typecode, useTime, effectFlg);
                if (result.S)
                {
                    resultInfo.Body = result.M;
                }
                else
                {
                    resultInfo.Result = 0;
                    resultInfo.Body = result.M;
                }
            }
            catch (Exception ex)
            {
                resultInfo.Result = -1;
                resultInfo.Body = ex.Message;
            }
            return resultInfo;
        }
    }
}